473,416 Members | 1,869 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

style select tag

Hi,
is it possible to style the elements from an dropdownmenue <select>
<option></option> </select> tag ?
Thanks for any help.
Rolf
Jul 20 '05 #1
9 82056
Rolf Brauser schreef:
Hi,
is it possible to style the elements from an dropdownmenue <select>
<option></option> </select> tag ?


Yes.
<head>
<style type="text/css">
<!--
..listheader {
color: #FFFFFF;
background: #000000;
}
..listdata {
color: #000000;
background: #FFFF66;
}
-->
</style>
</head>
<body>
<form action="" method="get">
<select>
<option selected>Beers of the World</option>
<option class="listheader">Campbelltown</option>
<option class="listdata"> - Springbank 21 yr.</option>
<option class="listdata"> - Springbank 15 yr.</option>
<option class="listdata"> - Springbank 12 yr. </option>
<option class="listdata"> - Glen Scotia </option>
<option class="listheader">Highland</option>
<option class="listdata"> - Royal Lochnager Selected Reserve </option>
<option class="listdata"> - Oban 14 yr. </option>
<option class="listdata"> - Lock Dhu Black 10 yr. </option>
<option class="listdata"> - Highland Park 12 yr.</option>
<option class="listdata"> - Glenmorangie 1971 Vintage. </option>
</select>
</form>
</body>
--
Edwin van der Vaart
http://www.semi-conductor.nl/ Links to Semiconductors sites
http://www.evandervaart.nl/ Under construction
Jul 20 '05 #2
> Yes.
<head>
<style type="text/css">
<!--
.listheader {
color: #FFFFFF;
background: #000000;
}
.listdata {
color: #000000;
background: #FFFF66;
}


Hi Edwin,
Thanks that rocks nice, but isnt exactly what I meant. Is it also possible
to color the border, the arrow, and the other scrollbar elements?
Rolf

Jul 20 '05 #3
On Tue, 5 Oct 2004 17:39:06 +0200, Rolf Brauser <fa******@a1.net> wrote:
Yes.
<head>
<style type="text/css">
<!--
.listheader {
color: #FFFFFF;
background: #000000;
}
.listdata {
color: #000000;
background: #FFFF66;
}


Hi Edwin,
Thanks that rocks nice, but isnt exactly what I meant. Is it also
possible
to color the border, the arrow, and the other scrollbar elements?
Rolf


Those are part of the OS and aren't really smart to mess with even where
you can. Some studies have shown decreased usability when these arenm't
easily recognized.
Jul 20 '05 #4
Edwin van der Vaart <pi************@yahoo.co.uk>:
.listheader {
color: #FFFFFF;
background: #000000;
}
.listdata {
color: #000000;
background: #FFFF66; <select>
<option selected>Beers of the World</option>
<option class="listheader">Campbelltown</option>
<option class="listdata"> - Springbank 21 yr.</option>
<option class="listdata"> - Springbank 15 yr.</option>
<option class="listdata"> - Springbank 12 yr. </option>
<option class="listdata"> - Glen Scotia </option>
<option class="listheader">Highland</option>
<option class="listdata"> - Royal Lochnager Selected Reserve </option>
<option class="listdata"> - Oban 14 yr. </option>
<option class="listdata"> - Lock Dhu Black 10 yr. </option>
<option class="listdata"> - Highland Park 12 yr.</option>
<option class="listdata"> - Glenmorangie 1971 Vintage. </option>
</select>


Eek! More like:

optgroup {
color: #FFF;
background: #000;
}
option {
color: #000;
background: #FF6;
}

<fieldset><legend>Beers of the World</legend><select multiple>
<optgroup label="Campbelltown">
<option value="sb21">Springbank 21 yr.</option>
<option value="sb15">Springbank 15 yr.</option>
<option value="sb12">Springbank 12 yr.</option>
<option value="glsc">Glen Scotia</option>
</optgroup>
<optgroup label="Highland">
<option value="rlsr">Royal Lochnager Selected Reserve</option>
<option value="ob14">Oban 14 yr.</option>
<option value="ldb10">Lock Dhu Black 10 yr.</option>
<option value="hp12">Highland Park 12 yr.</option>
<option value="gm71">Glenmorangie 1971 Vintage.</option>
</optgroup>
</fieldset></select>

Of course CSS conforming UAs do not have to style form widgets and some
indeed choose not to or only to a certain degree.

P.S.: 21-year-old beer?

--
No sig today, my .sig has gone away
The divider stands forlorn, a symbol of the dawn
No sig today, it seems a common sight
But people reading by don't know the reason why
Jul 20 '05 #5
Christoph Paeper schreef:

[snip some css and html code]
Eek! More like:

[snip corrected css and html code]
Thanx for correcting them.
I was in a bit hurry.
Of course CSS conforming UAs do not have to style form widgets and some
indeed choose not to or only to a certain degree.

P.S.: 21-year-old beer?


Heee.
It was an example from a cd of Dreamweaver MX 2004 Bible :-P
--
Edwin van der Vaart
http://www.semi-conductor.nl/ Links to Semiconductors sites
http://www.evandervaart.nl/ Under construction
Jul 20 '05 #6
Those are part of the OS and aren't really smart to mess with even where
you can. Some studies have shown decreased usability when these arenm't
easily recognized.


I wont put a white font on a white background. It depends on how u design
things.
Jul 20 '05 #7
On Wed, 6 Oct 2004 14:43:02 +0200, Rolf Brauser <fa******@a1.net> wrote:
Those are part of the OS and aren't really smart to mess with even where
you can. Some studies have shown decreased usability when these arenm't
easily recognized.
I wont put a white font on a white background.


Interesting. You understand the color contrast will be... insufficiently
readable?
It depends on how u design
things.


Perhaps we need to see a sample of what you intend, and post a URP to the
uploaded example. Because in my experience, what you're after is at best
unnecessary and at worst disasterous.
Jul 20 '05 #8
On Wed, 6 Oct 2004 14:43:02 +0200, Rolf Brauser wrote:
I wont put a white font on a white background.


Does that mean..
a) I want to put.. (wont -> want)
b) I will not put.. (wont -> won't -> will not)

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.lensescapes.com/ Images that escape the mundane
Jul 20 '05 #9
On Wed, 06 Oct 2004 13:24:23 GMT, Andrew Thompson <Se********@www.invalid>
wrote:
On Wed, 6 Oct 2004 14:43:02 +0200, Rolf Brauser wrote:
I wont put a white font on a white background.


Does that mean..
a) I want to put.. (wont -> want)
b) I will not put.. (wont -> won't -> will not)


Good eye - my response was predicated on "want to".
Jul 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Andrus | last post by:
I want that if user clicks in a checkbox, the strike-through effect applices to current table row. I tried the following code in IE, but nothing happens. Any idea ? <table> <tr><td><input...
4
by: Jeff Anderson | last post by:
Is there a style for a select option's "selected" color? For example: <HTML> <BODY> <FORM NAME="form1"> <SELECT NAME="mySelect" SIZE="7" style="background-color:red;"> <OPTION>Test 1...
5
by: Jeremy | last post by:
Apologies if the terminology isn't quite right here... say we have the following code: <SELECT NAME="p1_val" class=list-element> If the class "list-element" isn't defined, is it possible...
9
by: netclectic | last post by:
I'm dynamically adding options to a select list in javascript and i need to be able to set the height of the option, but setting style.height has not effect, I also tried style.pixelHeight but no...
5
by: Ben | last post by:
I have a form for data entry which is in a table. I have a select box to enter a customer name, which takes it's options from the customer database. I have a button to add a new customer. What I...
5
by: johnsuth | last post by:
I want to produce a trivial demonstration of dynamic modification. I thought that pressing a button might change its color. I studied O'Reillys books and successfully created the button with a...
5
by: Isha | last post by:
Hi all, I wanted to change the background color for only the first option in a select box, but following changed the background color for the whole dropdown box. <select name="alltags"...
1
by: John Devlon | last post by:
Hi, Does anyone know how to apply a style rule to controle? Where can i select de style role after the file has been linked to the page ? I can do it by code but is there a window that shows...
2
by: plsHelpMe | last post by:
Hi All, I am facing a weired issue. I am having a search form with some of the fields on it and a button which submits these fields values. Functionaly everything is working fine but sometimes...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.